/**
 * Alipay.com Inc.
 * Copyright (c) 2004-2014 All Rights Reserved.
 */
package com.lshtv.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;

import com.lshtv.base.PageList;
import com.lshtv.base.WorkQuery;
import com.lshtv.dao.WorkDAO;
import com.lshtv.model.Work;

/**
 * 
 * @author danjingyu
 * @version $Id: WorkQueryFacadeImpl.java, v 0.1 2014-3-11 下午10:51:59 danjingyu Exp $
 */
public class WorkQueryFacadeImpl implements WorkQueryFacade {
    @Autowired
    private WorkDAO workDAO;

    /** 
     * @see com.lshtv.service.WorkQueryFacade#queryByPageO()
     */
    public PageList<Work> queryByPage(WorkQuery query) {
        return workDAO.findPage(query.getPageNo(), query.getPageSize(), query.getType(),
            query.getItem());
    }

    /** 
     * @see com.lshtv.service.WorkQueryFacade#queryTop()
     */
    public List<Work> queryTop() {
        return workDAO.findTop();
    }

    /** 
     * @see com.lshtv.service.WorkQueryFacade#deleteWork(int)
     */
    public void deleteWork(int id) {
        Work work = workDAO.findById(id);
        workDAO.delete(work);
    }

    /** 
     * @see com.lshtv.service.ArticleQueryFacade#selectById(int)
     */
    public Work selectById(int id) {
        return workDAO.findById(id);
    }

    public void setWorkDAO(WorkDAO workDAO) {
        this.workDAO = workDAO;
    }

}
